
const {join}=require('path');
const {
    existsSync,
    writeFileSync,
    readdirSync,
    unlinkSync
}=require('fs')

class Utils{
    constructor(){
        this.folderPath=join(process.cwd(),'src');

    }

    addFile(filename){
        //检测文件是否存在
        let newp=join(this.folderPath,filename)
        if(existsSync(newp)){
            console.log('该文件已存在');
        }else{
            writeFileSync(newp,'66');
            console.log('文件成功');
        }
    }

    getfile(){
        return readdirSync(this.folderPath)
    }

    delfile(filename){
        let newp=join(this.folderPath,filename)
        unlinkSync(newp)
    }
}

module.exports =new Utils();
